import { request } from '@umijs/max';
import Omit from 'omit.js';

export function getTest() {
  return request('/server2/test', {
    method: 'GET',
  });
}

// 获取个人信息
export function getUserInfo(id: number) {
  return request('/server2/user', {
    method: 'GET',
    params: {
      id,
    },
  });
}

// 添加评论
export function addComment(data: any) {
  return request('/server2/addComment', {
    method: 'POST',
    data,
  });
}

// 回复评论
export function replyComment(data: any) {
  return request(`/server2/replyComment/${data.commentID}`, {
    method: 'POST',
    data: Omit(data, 'commentID'),
  });
}

// 获取评论 用户ID
export function getComment(id?: number) {
  return request('/server2/getComment', {
    method: 'GET',
    params: {
      id,
    },
  });
}

// 点赞 踩
export function onSupport(data: any) {
  return request('/server2/onSupport', {
    method: 'PUT',
    data,
  });
}
